<?php

	require_once 'database.php';

	echo 'recreating DB...';
	
	Database::initDB();
	
	$success = mysql_query('CREATE TABLE IF NOT EXISTS feeds_data (
				  ID int(11) NOT NULL AUTO_INCREMENT,
				  SITE varchar(500) COLLATE utf8_unicode_ci NOT NULL,
				  CATEGORY varchar(500) COLLATE utf8_unicode_ci NOT NULL,
				  URL varchar(2000) COLLATE utf8_unicode_ci NOT NULL,
				  PRIMARY KEY (ID)
				) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1'
	);
	
	if ($success) {		
		echo $success;
	} else {
		echo "Reason: ".mysql_error()."\n";	
	}
	
	$success = mysql_query('CREATE TABLE IF NOT EXISTS item_data (
				  ID int(11) NOT NULL AUTO_INCREMENT,
				  SITE varchar(500) COLLATE utf8_unicode_ci NOT NULL,
				  CATEGORY varchar(500) COLLATE utf8_unicode_ci NOT NULL,
				  PUBDATE varchar(500) COLLATE utf8_unicode_ci NOT NULL,
				  TITLE varchar(2000) COLLATE utf8_unicode_ci NOT NULL,
				  LINK varchar(2000) COLLATE utf8_unicode_ci NOT NULL,
				  DESCRIPTION varchar(5000) COLLATE utf8_unicode_ci NOT NULL,
				  PRIMARY KEY (ID)
				) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1'
	);
	
	if ($success) {		
		echo $success;
	} else {
		echo "Reason: ".mysql_error()."\n";	
	}
?>